<extend name="Public/base"/>
<block name="body">
    <link rel="stylesheet" href="__PUBLIC__/dist/css/bootstrapValidator.css"/>
    <link rel="stylesheet" href="__PUBLIC__/fileinput/lightbox.css"/>
    <link rel="stylesheet" href="__PUBLIC__/fileinput/fileinput2.css"/>
    <!--<link rel="stylesheet" href="__PUBLIC__/fileinput/teach.css"/>-->
    <style>
        #ep_total_sales .chart-bar li , ul.chart-legend.chart-line li {
            float: left;
            margin: 0px 5px;
        }
        #ep_total_sales .chart-bar{padding-left:15px;}
        #home_video .caption{
            position: absolute;
            bottom: 0;
            width: 100%;
            color: #207ECE;
            left: 0;
            background-color: rgba(210,214,222,0.3);
            border-radius: 4px;
            height: 52px;
            background-image: none;
            display: none;
        }
        .outin {
            background: url(__PUBLIC__/img/enter.png) center center no-repeat;
            display: inline-block;
            width: 30px;
            height: 30px;
        }
    </style>
    <!-- Main content -->
    <section class="content">
    <div class="row">
        <!--教程模块 -->
        <?php if (false): ?>
        <include file="teach"/>
        <?php endif; ?>
    </div>
      <!-- Main row -->
      <div class="row">
        <!-- Left col -->
        <section class="col-lg-6 connectedSortable">

            <!-- quick email widget 邮件模块  emailListData-->
            <div class="nav-tabs-custom">
                <ul class="nav nav-tabs pull-right">
                    <li class="pull-left header">
                        <a href="<?php echo $edata['login_url'] ?>" target="_blank" title="{$Think.lang.Login}" style="color: #3c8dbc;padding: 0">
                            <i class="fa fa-envelope"></i>&nbsp; {$Think.lang.Mail List}
                        </a>
                    </li>
                    <volist name="emailList" id="e" key="num">
                        <li class="<?php if($e['is_main']): ?>active <?php endif; ?>"><a href="#email<?php echo $num ?>-panel" data-toggle="tab">{$e['mailbox_suffix']}</a> </li>
                    </volist>
                </ul>
                <div class="tab-content no-padding">
                    <volist name="emailListData" id="edata" key="number">
                        <div class="tab-pane <?php if($edata['is_main']): ?>active<?php endif; ?>" id="email<?php echo $number ?>-panel">
                            <div class="box box-primary">
                                <div class="box-header">
                                    <div class="box-tools pull-right" data-toggle='tooltip' title='登录邮件' data-placement='left'> 
                                        <?php if ($edata['unread']): ?>
                                        <a href="javascript:;"  ><small>{$Think.lang.UnRead}</small>: &nbsp;<span class="label badge bg-red" >{$edata['unread']}</span></a>
                                        <?php endif; ?>
                                        <a href="<?php echo $edata['login_url'] ?>" target="_blank" style="padding-left: 10px"><i class="outin"></i></a>
                                    </div>
                                </div>
                                <div class="box-body">
                                    <ul class="todo-list">
                                        <?php if (count($edata['data'])): ?>
                                        <?php foreach ($edata['data'] as $key => $val) { ?>
                                        <li class="row" style="margin:0px;">
                                            <div class="col-md-3">
                                              <span class="handle">
                                                <i class="fa fa-ellipsis-v"></i>
                                                <i class="fa fa-ellipsis-v"></i>
                                              </span>
                                                <span class="text-overflow"><?php echo foatmack($val->Sender); ?></span>
                                            </div>

                                          <span class="mailbox-subject text-overflow col-md-6 col-xs-12">
                                          <a href="javascript:;" data="<?php echo $val->MailID ?>" key="<?php echo $number ?>" class="reJumpUrl" target="_black" >
                                              <?php
                                                $new_label = 'label-default';
                                                if($val->New) :
                                              $new_label = 'label-danger';
                                              ?>
                                              <strong> <?php echo $val->Subject ?> </strong>
                                              <?php else: ?>
                                              <?php echo $val->Subject ?>
                                              <?php endif; ?>
                                          </a></span>
                                            <small class="label  mailbox-date pull-right <?php echo $new_label ?> hidden-xs col-md-2"><i class="fa fa-clock-o"></i> <?php echo date('Y-m-d',$val->Time); ?></small>
                                        </li>
                                        <?php } ?>
                                        <?php else: ?>
                                        <li>
                                            {$Think.lang.No mail for a moment}
                                        </li>
                                        <?php endif; ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </volist>
                </div>
            </div>

            <!-- Tabs within a box   C6模块 -->
            <div class="nav-tabs-custom">
                <ul class="nav nav-tabs pull-right">
                    <li data-toggle='tooltip' title='登录C6' data-placement='left'><a href="<?php echo $c6_login_url ?>" target="_blank" style="color: #3c8dbc"><i class="outin"></i></a></li>
                    <li><a href="#c6-toread" data-toggle="tab">{$Think.lang.To Read} &nbsp;<span class="label label-danger toreader-label"></span></a></li>
                    <li class="active"><a href="#c6-todo" data-toggle="tab">{$Think.lang.To Do}&nbsp;<span class="label label-danger todo-label"></span></a> </li>
                    <li class="pull-left header"><a href="<?php echo $c6_login_url ?>" target="_blank" title="{$Think.lang.Login}" style="color: #3c8dbc;padding: 0"><i class="fa fa-inbox"></i> C6{$Think.lang.System}</a></li>
                </ul>
                <div class="tab-content no-padding">
                    <!-- Morris chart - Sales -->
                    <div class="  tab-pane active" id="c6-todo" >
                        <!-- TO DO List -->
                        <div class="box box-primary" id="todo-lists">
                            <div class="box-body">
                                <ul class="todo-list">
                                </ul>
                            </div><!-- /.box-body -->
                        </div><!-- /.box -->

                    </div>
                    <div class=" tab-pane" id="c6-toread">
                        <!-- TO DO List -->
                        <div class="box box-primary" id="toreader-rlists">
                            <div class="box-body">
                                <ul class="todo-list"></ul>
                            </div><!-- /.box-body -->
                        </div><!-- /.box -->
                    </div>
                </div>
            </div>

            <!--favorites 收藏夹-->
            <div class="box box-info" id="ets-favorites-lists">
                <div class="box-header">
                    <a href="__APP__/Link/Link" target="_blank" title="{$Think.lang.Login}" >
                        <i class="fa  fa-gratipay"></i>
                        <h3 class="box-title">{$Think.lang.favorites}</h3>
                    </a>
                    <div class="box-tools pull-right" data-toggle='tooltip' title='登录收藏夹' data-placement='left'>
                        <a href="__APP__/Link/Link" target="_blank" style="padding-left: 10px"><i class="outin"></i></a>
                    </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                    <ul class="todo-list">
                        <?php if(count($conllectLink)): ?>
                        <?php foreach ($conllectLink as $key => $link) {
                        ?>
                        <li class="row " style="margin:0px;">
                            <div class="col-md-1">
                              <span class="handle">
                                <i class="fa fa-ellipsis-v"></i>
                                <i class="fa fa-ellipsis-v"></i>
                              </span>
                            </div>
                            <span class="mailbox-subject text-overflow col-md-9 col-xs-12">
                              <a href="{$link['url']}"  target="_black" >
                                  <?php if($link['model'] == 'link'): ?>
                                  <?php echo  L($link['title']); ?>
                                  <?php else: ?>
                                  <?php echo  $link['title']; ?>
                                  <?php endif; ?>
                              </a>
                            </span>
                            <!-- Emphasis label -->
                           <a href="javascript:;" url="__URL__/removeFavoritesLink/id/{$link['id']}/model/{$link['model']}" class="ajax-get pull-right hidden-xs  col-md-2 text-right "><small class="label label-info">{$Think.lang.Remove}</small></a>
                        </li>
                        <?php } ?>
                        <?php else: ?>
                        <li> {$Think.lang.No favorites}</li>
                        <?php endif; ?>
                    </ul>
                </div><!-- /.box-body -->
            </div><!-- /.box -->

            <!-- 图片模块 -->
            <div class="box box-default">
                <div class="box-header">
                    <a href="<?php echo U('/Picture/index'); ?>" target="_blank" title="{$Think.lang.Login}">
                    <span class="glyphicon glyphicon-picture" aria-hidden="true"></span>
                    <h3 class="box-title">{$Think.lang.Picuture}</h3>
                    </a>
                    <div class="box-tools pull-left" data-toggle='tooltip' title='登录图片库' data-placement='left'>
                        <a href="<?php echo U('/Picture/index'); ?>" target="_blank"><i class="outin"></i></a>
                    </div>
                </div>
                <div class="box-body">
                	  <ul class="list-unstyled list thumbnails">
                            <volist name="picturelist" id="vo" >
                                <?php if($vo['origin_url']||$vo['thumbnail_url']): ?>
                                <li class="col-md-6 col-sm-12 ">
                                    <div class="thumbnail" style="position: relative;">
                                        <a href="<?php echo  getHttpHost($vo['impression_url']);?>" onclick="checkPicture(this)" data-title="{$vo['title_cn']}{$vo['title_en']}" data-lightbox="group"><img src="<?php echo  getHttpHost($vo['thumbnail_url']);?>"
                                            class="img-responsive thumbnail margin no-padding thumbnail-img thumbnail-img2" style="max-height: 240px" /></a>

                                        <div class="caption caption-one" >
                                            <div class="col-md-9">                                               
                                               <h5 >{$vo['title_cn']}{$vo['title_en']}</h5>
                                            </div>
											<div class=" col-md-3">
                                                    <a target="_blank" href="__APP__/Picture/dowload?imageurl=<?php echo $vo['origin_url'];?>"   class="btn   pull-right btn-primary-a"></a>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                                <?php endif; ?>
                            </volist>
                    </ul>
                </div>
            </div>

        </section><!-- /.Left col -->
        <!-- right col (We are only adding the ID to make the widgets sortable)-->
        <section class="col-lg-6 connectedSortable">

            <!-- Forun Chat box  论坛模块-->
            <div class="box box-success">
                <div class="box-header with-border">
                    <a href="{$forum_login_url}" target="_blank" title="{$Think.lang.Login}">
                        <i class="fa fa-comments-o"></i>
                        <h3 class="box-title">{$Think.lang.Internal Forum}</h3>
                    </a>
                    <div class="box-tools pull-right" data-toggle='tooltip' title='登录论坛' data-placement='left'>
                        <!--<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>-->
                        <!--<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>-->
                        <a href="{$forum_login_url}" target="_blank"><i class="outin"></i></a>
                    </div>
                </div>
                <div class="box-body chat" id="chat-box">
                    <?php Vendor('Forum.ForumApi'); $ForumApi = new \ForumApi();?>
                    <?php foreach ($forumMessageList as $key => $item) {  ?>

                    <div class="item">
                        <img src="<?php echo $item['UserPic']; ?>" alt="user image" class="online" onerror="javascript:this.src='http://oa.yuntuservice.com:55556/images/common/noavatar_small.gif';" alt="pic"/>
                        <p class="message">
                            <a href="javascript:;" class="name">
                                <small class="text-muted pull-right hidden-xs"><i class="fa fa-clock-o"></i> <?php echo $item['MessageTime']; ?></small>
                                <!--<small class="text-muted pull-right" style="margin-right:10px"> {$Think.lang.Views}：<?php echo $item['Views'] ?> </small>-->
                                <!--<small class="text-muted pull-right" style="margin-right:10px"> {$Think.lang.Replies}：<?php echo $item['Replies'] ?></small>-->
                                <?php echo $item['MessageUser']; ?>
                            </a>
                            <a href="<?php echo $ForumApi->getTitleUrl($item['MessageTid']); ?>" target="_blank">
                                <?php echo $item['MessageTitle']; ?>
                            </a>
                        </p>
                    </div><!-- /.item -->
                    <?php } ?>
                </div><!-- /.chat -->
            </div><!-- /.box (chat box) -->

            <!-- 视频模块 -->
            <div class="box box-default" id="home_video">
                <div class="box-header">
                    <a href="<?php echo U('/Video/index'); ?>" target="_blank" title="{$Think.lang.Login}">
                        <span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
                        <h3 class="box-title">{$Think.lang.Video}</h3>
                    </a>
                    <div class="box-tools pull-right" data-toggle='tooltip' title='登录视频' data-placement='left'>
                        <a href="<?php echo U('/Video/index'); ?>" target="_blank"><i class="outin"></i></a>
                    </div>
                </div>
                <div class="box-body">
                    <ul class="list-unstyled list thumbnails">
                        <volist name="videolist" id="vo" >
                            <?php if($vo['youku_url']||$vo['youtube_url']): ?>
                            <li class="col-md-6 col-sm-12 ">
                                <div class="thumbnail thumbnail-img" style="position: relative;">
                                    <img src="<?php echo  $vo['video_thumbnail']==''?'__PUBLIC__/img/video_default.png':$vo['video_thumbnail'] ?>"
                                         class="img-responsive thumbnail margin no-padding" style="max-height: 240px" />

                                    <div class="caption">
                                        <div class="col-md-9">
                                            <h5 >{$vo['title_cn']}{$vo['title_en']}</h5>
                                        </div>
                                        <div class=" col-md-3">
                                            <a href="javascript:;" class="image-btn-primary pull-right" data-title="video detail" data-toggle="modal" data-target="#video-detail" data="{$vo['id']}"
                                               onclick="ajaxLoadViewDetail(this)"></a>
                                        </div>
                                    </div>
                                </div>
                            </li>
                            <?php endif; ?>
                        </volist>
                    </ul>
                </div>
            </div>

            <include file="Video/video_detail"/>
        </section><!-- right col -->
      </div><!-- /.row (main row) -->
        <!--<div class="row">-->
            <!--<section class="col-md-6">-->
    <!---->
            <!--</section>-->
        <!--</div>-->
    </section><!-- /.content -->

</block>

<block name="script">
        <!-- AdminLTE dashboard demo (This is only for demo purposes)
    <script src="__PUBLIC__/dist/js/pages/dashboard.js" type="text/javascript"></script>  -->
    <!-- Morris.js charts
    <script src="__PUBLIC__/plugins/raphael/raphael-min.js"></script>
    <!-- Sparkline -->
    <script src="__PUBLIC__/plugins/sparkline/jquery.sparkline.min.js" type="text/javascript"></script>
    <!-- jvectormap 
    <script src="__PUBLIC__/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/plugins/jvectormap/jquery-jvectormap-world-mill-en.js" type="text/javascript"></script>-->
    <!-- jQuery Knob Chart -->
    <script src="__PUBLIC__/plugins/knob/jquery.knob.js" type="text/javascript"></script>
    <!-- daterangepicker 
    <script src="__PUBLIC__/plugins/moment/moment.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>-->
    <!-- datepicker
    <script src="__PUBLIC__/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>-->
    <script src="__PUBLIC__/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
    <!-- FastClick -->
    <script src='__PUBLIC__/plugins/fastclick/fastclick.min.js'></script>

    <script src='__PUBLIC__/js/CommonPerson.js'></script>
    <link href="__PUBLIC__/js/showLoading.css" rel="stylesheet" type="text/css" />

    <script src="__PUBLIC__/dist/js/bootstrapValidator.js" type="text/javascript"></script>
    <script src="__PUBLIC__/dist/js/language/zh_CN.js" type="text/javascript"></script>
    <script src="__PUBLIC__/dist/js/validator.js" type="text/javascript"></script>
    <script src="__PUBLIC__/fileinput/lightbox.js" type="text/javascript"></script>
    <!--<script src="__PUBLIC__/fileinput/teach.js" type="text/javascript"></script>-->
    

  <script type="text/javascript">
  
  $(function() {
    $(".todo-list").sortable({
      placeholder: "sort-highlight",
      handle: ".handle",
      forcePlaceholderSize: true,
      zIndex: 999999
    });

//  $(".connectedSortable").sortable({
//    placeholder: "sort-highlight",
//    connectWith: ".connectedSortable",
//    handle: ".box-header, .nav-tabs",
//    forcePlaceholderSize: true,
//    zIndex: 999999
//  });
 //关闭拖拉效果
//  $(".connectedSortable .box-header, .connectedSortable .nav-tabs-custom").css("cursor", "move");

  //  $('#chat-box').slimScroll({height: '360px'});

    //获取c6 单点登陆的链接
    var  jump =  '<?php echo $c6_login_url; ?>';
 

     //如果存在代阅信息，读取数据并且显示
    <?php if ($flat_info_waiting) : ?>
      writeJsonInfo('<?php echo $flat_info_waiting; ?>','#toreader-rlists','.toreader-label');
    <?php  endif; ?>

     //如果存在代办事件，读取数据并且显示
    <?php if ($pending_work_list) : ?>
      writeJsonInfo('<?php echo $pending_work_list; ?>','#todo-lists','.todo-label');
    <?php  endif; ?>
    
    function writeJsonInfo(object,id,label) {
        var  rdata  = $.parseJSON(object);
        var  rlists = rdata.MessageList;
  
        if (rlists == null){
            var html = '<li >{$Think.lang.No data can be displayed}</li>';
            $(id+' ul.todo-list').append(html);  
        } else {
            $(label).html(rlists.length);
          for (var k in rlists) {
              if (k>8) break;
              var html = '<li class="row" style="margin: 0"><div class=" col-md-3"><span class="handle"><i class="fa fa-ellipsis-v"></i> <i class="fa fa-ellipsis-v"></i> </span>' +
                      '<span class="text-overflow  text-black">'+rlists[k].ModuleTypeName+' :</span></div>';
              html += '<span class="text col-md-6"><a href="'+jump+rlists[k].MessageUrl+'" target="_blank">'+rlists[k].MessageTitle +'</a></span>';
              var day1 = new Date(rlists[k].SendTime);
              var day2 = new Date();
              var days=Math.floor((day2-day1)/(24*3600*1000));
              html += ' <small class="label label-danger hidden-xs pull-right col-md-2"><i class="fa fa-clock-o"></i> '+ days +' days</small>';
              html += '</li>';
              $(id+' ul.todo-list').append(html);  
          };
        }
    }
  });



  //刷新缓存
  $('#clear_cache_btn').bind('click',function(){
      CommonPerson.Base.LoadingPic.customFullScreenShow('update ...');
      $.post("__APP__/Public/refresh").done(function(data){
          if (data.status) {
              location.reload();
          }
      });
  });

  //邮件跳转
  $('.reJumpUrl').bind('click',function(){
      var mailid = $(this).attr('data');
      var object = $(this);

      CommonPerson.Base.LoadingPic.FullScreenShow();
      $.post("__APP__/Public/getReadMailUrl",{
          mailid:mailid,
          emailkey:object.attr('key')
      }).done(function(data){
          object.attr('href',data);
          object.unbind("click");
          CommonPerson.Base.LoadingPic.FullScreenHide();
          window.open(data, '_blank');
      });
  });



  /**
   *  视频模块
   */

  function ajaxLoadViewDetail(e) {
      var id = $(e).attr('data');
      $.post('__APP__/Video/viewDetail',{
          id:id
      },function(result){
          videoViewForm.reset();
          var data = $.parseJSON(result);
          var lan = '<?php echo LANG_SET ?>';
          var info = $('#toggle_info');
          var share = $('#toggle_share');
          var title = '';
          $('#no-find-video').html('');
          if (lan == 'zh-cn'){
              $('.detail.detail-video').attr('src',data.youku_url).attr('lan','zh-cn');
              title = data.title_cn;
              share.find('.share_link').val(data.youku_url);
              $('.toggle-video').html('<img src="__PUBLIC__/img/YouTube-logo.png" width="65px" title="YouTuBe" />');
              if (!data.youku_url){
                  $('#no-find-video').html('<img src="__PUBLIC__/img/exclamation.png"  />');
              }
          }else {
              title = data.title_en;
              $('.detail.detail-video').attr('src',data.youtube_url).attr('lan','en-us');
              share.find('.share_link').val(data.youtube_url);
              $('.toggle-video').html('<img src="__PUBLIC__/img/Yk-logo.png" width="65px" title="YouKu" />');
              if (!data.youtube_url){
                  $('#no-find-video').html('<img src="__PUBLIC__/img/exclamation.png"  />');
              }
          }
          $('.video-youtube').val(data.youtube_url);
          $('.video-youku').val(data.youku_url);

          info.find('.title_name').html(title);
          share.find('.share_title').val(title);
          share.find('.video_id').val(data.id);

          info.find('.intro').html(data.intro);
          info.find('.people').html(data.people);
          info.find('.tag').html(data.tag);
          info.find('.created_at').html(data.created_at);
          info.find('.category').html(data.category);
          info.find('.creator').html(data.creator);
          $('#videoViewForm .copytext').html('');
      });
  }

  $(function() {

      var nofindImg = '<img src="__PUBLIC__/img/exclamation.png"  class="img-responsive" style=" margin: 0 auto;" />';
    //视频平台切换
      $('.toggle-video').bind('click',function(){
          var video = $('.detail.detail-video');
          var youtube_url = $('.video-youtube').val();
          var youku_url = $('.video-youku').val();
          $('#no-find-video').html('');
          if (video.attr('lan') == 'zh-cn'){
              if(youtube_url == ''){
                  $('#no-find-video').html(nofindImg);
              }
              video.attr('src',youtube_url).attr('lan','en-us');
              $('#toggle_share').find('.share_link').val(youtube_url);
              $(this).html('<img src="__PUBLIC__/img/Yk-logo.png" width="65px" title="YouKu"  />');
          } else {
              if(youku_url == ''){
                  $('#no-find-video').html(nofindImg);
              }
              video.attr('src', youku_url).attr('lan', 'zh-cn');
              $('#toggle_share').find('.share_link').val(youku_url);

              $(this).html('<img src="__PUBLIC__/img/YouTube-logo.png" width="65px" title="YouTuBe"  />');
          }

      });


      $('#home_video .thumbnail').hover(function(){
          $(this).find('.caption').toggle();
      });
      iniAjaxFormDialog('#videoViewForm','#video-detail',true);
      Validator('videoViewForm');

  });

    $('.thumbnail').hover(function(){
          $(this).find('.caption-one').toggle();
      });

    // 查看器大图添加标题，下载按钮
     function checkPicture(e){
               var href=$(e).next().find(".btn-primary-a").attr("href");
               var target=$(e).attr("target");
                $(".lb-container").append('<div class=" col-md-3 btn-primary-a1-1"><a target="_blank"href="'+ href+ '"class="btn   pull-right btn-primary-a1" onclick="window.open(this.href);"></a></div></div>');
                $(".btn-primary-a1-1").css({"position":"absolute","right":"0","bottom":"20px","z-index":"1000"});
                $(".btn-primary-a1").css({"width":"92px","height":"30px","background":"url(__PUBLIC__/img/xiazai.png) center center no-repeat"});
            }
   </script>
</block>